[][src]Crate naia_shared

Naia Shared

Common functionality shared between naia-server & naia-client crates.

Modules

utils

Commonly used utility methods to be used by naia-server & naia-client

Structs

AckManager

Keeps track of sent & received packets, and contains ack information that is copied into the standard header on each outgoing packet

Connection

Represents a connection to a remote host, and provides functionality to manage the connection and the communications to it

ConnectionConfig

Contains Config properties which will be used by a Server or Client

EventManager

Handles incoming/outgoing events, tracks the delivery status of Events so that guaranteed Events can be re-transmitted to the remote host

EventPacketWriter

Handles writing of Event & Actor data into an outgoing packet

Instant

Represents a specific moment in time

LinkConditionerConfig

Contains configuration required to initialize a LinkConditioner

Manifest

Contains the shared protocol between Client & Server, with a data that is able to map Event/Actor TypeIds to their representation within specified enums. Also is able to create new Event/Actors using registered Builders, given a specific TypeId.

PacketReader

Contains an underlying byte payload, and provides a Cursor into that payload

Property

A Property of an Actor, that contains data which must be tracked for updates, and synced to the Client

Random

Container for cross-platform Random methods

SequenceBuffer

Collection to store data of any kind.

SequenceIterator

Iterator for a Sequence

SharedConfig

Contains Config properties which will be shared by Server and Client

StandardHeader

This header provides reliability information.

StateMask

The State Mask is a variable-length byte array, where each bit represents the current state of a Property owned by an Actor. The Property state tracked is whether it has been updated and needs to be synced with the remote Client

Timer

A Timer with a given duration after which it will enter into a "Ringing" state. The Timer can be reset at an given time, or manually set to start "Ringing" again.

Timestamp

A Timestamp for a moment in time that can be read/written to/from a byte stream

Enums

HostType

Blah

ManagerType

Every data packet transmitted has data specific to either the Event or Actor managers. This value is written to differentiate those parts of the payload.

PacketType

An enum representing the different types of packets that can be sent/received

Constants

MTU_SIZE

The maximum of bytes that can be used for the payload of a given packet. (See #38 of http://ithare.com/64-network-dos-and-donts-for-game-engines-part-v-udp/)

Traits

Actor

An Actor is a container of Properties that can be scoped, tracked, and synced, with a remote host

ActorBuilder

Handles the creation of new Actor instances

ActorEq

Handles equality of Actors.. can't just derive PartialEq because we want to only compare Properties

ActorMutator

Tracks which Properties have changed and need to be queued for syncing with the Client

ActorNotifiable

Represents a manager that must be notified when packets have been dropped or delivered

ActorType

An Enum with a variant for every Actor that can be synced between Client/Host

Event

An Event is a struct of data that can be sent and recreated on the connected remote host

EventBuilder

Handles the creation of new Events

EventClone

A Boxed Event must be able to clone itself

EventType

An Enum with a variant for every Event that can be sent to a remote host

HostTickManager

Manages the current tick on the host

Functions

find_my_ip_address

Helper method to find local IP address, if possible

interp_lerp

Returns an interpolation from one value to another by a specified amount

sequence_greater_than

Returns whether or not a wrapping number is greater than another

sequence_less_than

Returns whether or not a wrapping number is greater than another

wrapping_diff

Retrieves the wrapping difference between 2 u16 values wrapping_diff(1,2) will return 1 wrapping_diff(2,1) will return -1 wrapping_diff(65535,0) will return 1 wrapping_diff(0,65535) will return -1

Type Definitions

LocalActorKey

The key that represents an Actor in the Client's scope, that is being synced to the Client

SequenceNumber

Used to index packets that have been sent & received